<template>
    <el-avatar :src="imgSrc" :size="size < 0 ? 'default' : size" :style="style" @error="handleError">
    </el-avatar>
</template>
<script setup lang="ts">
import { previewFile } from '@/api/file';
import { defineProps, ref } from 'vue'
import loadinggif from '@/assets/images/loading.gif'
import defaultAvatar from '@/assets/images/defaultUser.png'
import { ServerConfig } from '@/common/config';
const props = defineProps({
    src: {
        type: String,
        default: '#'
    },
    style: {
        type: Object,
        defaul: {}
    },
    size: {
        type: Number,
        default: -1
    }
})
const imgSrc = ref(props.src)
const style = ref(props.style)
const size = ref(props.size)
const loadContent = async () => {
    const s = imgSrc.value

    imgSrc.value = ServerConfig.REMOTE_FILE_BASE + s
}
const handleError = () => {
    imgSrc.value = defaultAvatar
}
loadContent()
</script>
<style lang="scss"></style>